module.exports = (app) => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;

  const CategoriesSchema = new Schema({
    name: {
      type: mongoose.Schema.Types.Mixed,
      required: true,
    },
    parentId: {
      type: String,
      required: true, // 0 代表没有父级分类
    },
    level: {
      type: Number,
      required: true,
      enum: [1, 2, 3],
    },
    isAdmin: {
      type: Boolean,
      default: false,
    }
  });

  return mongoose.model("Categories", CategoriesSchema, "Categories");
};
